$(function () {
    var billId = $.util.getRequest("billId")
    $.util.get($.util.getRequestJson('/json/consumeManage.orderDetail.json'),{billId:billId},function(data){
        $('#orderDetail').form('load', data.data);
        $("#productImg").attr('src',data.data.productImg);
        initDatagrid();
        $("#orderItems").datagrid('loadData',data.rows);
    });
})

// 表格内容初始化
function initDatagrid() {
    $('#orderItems').datagrid({
        fit: true,
        pagination: true,
        pageSize: 30,
        checkOnSelect: false,
        selectOnCheck: false,
        singleSelect: true,
        fitColumns: true,
        columns: [
            [
                {
                field: 'title',
                title: '商品名称',
                width:15
            },{
                field:'total',
                title:'数量',
                width:15
            },{
                field:'totalScore',
                title:'消费积分总数',
                width:15
            },{
                field: 'path',
                title: '商品图片',
                width:15,
                formatter:function (value, row, index) {
                    return "<img width='20' height='20' src='"+value+"'>";
                }
            }
            ]
        ]
    });
}